{include file="common/head"/}
<style>
    .layui-table-cell{height: auto;}
    .layui-table-cell ul li a{color: #1C8FEF;display: block;border: 1px solid #ececec;padding: 3px 8px;}
    .layui-table-cell ul li a:hover{color: #005580}
</style>
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>部门绩效列表</legend>
    </fieldset>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show" style="float: left">
            <form class="layui-form" action="">
                <div style="float:left;margin-left:-119px">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="width: 500px;">
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" id="time" placeholder="开始时间">
                                    <input type="text" class="layui-input" id="time1" placeholder="结束时间" style="margin-left: 196px;margin-top: -37px;">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div style="float:left;">
                    <div class="layui-form-item" style="    margin-left: -217px;margin-top: 1px;">
                        <div class="layui-input-block" style="width: 210px;">
                            <select  class="form-control input-sm" name="status" lay-filter="status" aria-invalid="false" id="status1">
                                <option value="0" disabled selected style="display:none">请选择考核项分类(默认全部)</option>
                                {volist name="cate_data" id="vo"}
                                <option value="{$vo.cate_id}">{$vo.title}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                </div>
                <div style="float:left;">
                    <div class="layui-form-item" style="    margin-left: -103px;margin-top: -2px;">
                        <div class="layui-input-block" style="width: 500px;">
                            <div class="layui-inline" >
                                <div class="layui-input-inline" style="width: 200px;">
                                    <input type="text" id="keyword" name="keyword" autocomplete="off" placeholder="请输入部门名称" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline" style="margin-right: 6px;">
                                <div class="layui-btn-group layui-inline">
                                    <a  href="{:url('sectionList')}" class="layui-btn layui-btn-primary">重置</a>
                                    <button id="search" class="layui-btn layui-btn-normal" type="button" lay-submit lay-filter="formDemo" style="background-color: #009688;">
                                        <i class="layui-icon">&#xe615;</i>查找
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>

            </form>
        </div>
    </div>
    <table class="layui-table" id="list" lay-filter="list"></table>
</div>

{include file="common/foot"/}
<script>
    layui.use(['table','element','laydate','form'], function() {
        var table = layui.table, form = layui.form, $ = layui.jquery,laydate = layui.laydate;
        var tableIn = table.render({
            id: 'user',
            elem: '#list',
            url: "{:url('sectionList')}",
            method: 'post',
            page: true,
            even:true,
            cols: [[
                {field: 'title',title: '部门名称', width: 120,style:'height: auto;',templet:'#add_parentname'},
                {field: 'zongfen', title: '总分', width: 180},
                {field: 'sort', title: '排名', width: 180},
            ]],
            limit: 10 //每页默认显示的数量
        });
        $('#search').on('click', function () {
            // 关键字
            var keyword = $('#keyword').val();
            // 开始时间
            var time = $('#time').val();
            // 结束时间
            var time1 = $('#time1').val();
            // 状态
            var status1 = $('#status1').val();

            if(time1!=''&&time==''){
                layer.msg('请选择起始时间！', {icon: 0});
                return;
            }

            if (time>time1){
                layer.msg('起始时间应小于结束时间！', {icon: 0});
                return;
            }


            if (($.trim(keyword) === '') && ($.trim(status1) == 0) && ($.trim(time) === '') && ($.trim(time1) === '')) {
                layer.msg('请选择查找条件！', {icon: 0});
                return;
            }

            //表格重载
            tableIn.reload({
                //传递额外参数
                where: {keyword: keyword,start_time:time,end_time:time1,status:status1}
            });
        });

        //年月选择器
        laydate.render({
            elem: '#time'
            ,format: 'yyyy-MM-dd'
        });
        //年月选择器
        laydate.render({
            elem: '#time1'
            ,format: 'yyyy-MM-dd'
        });
    });
</script>
</body>
</html>